/*Prepared Using STATA 19 MP: September 19, 2025*/
cap cd "C:\Users\ejm5\Dropbox\Vietnam Election project\2021_Election\Replication"
use "9_election_working.dta", clear
set scheme plottig


********************************************************************************************/
/*No Difference in Success Rate of Treatment Package Delivery in Phase 2*/
replace p2_physicaldelivery="Fail" if p2_physicaldelivery=="Failed"
replace p2_physicaldelivery="Fail" if p2_physicaldelivery=="N/A"
tabout p2_physicaldelivery treatment_group if control==0 using "Tables\AppendixA21_DeliverSuccess", append cells(freq col) f(0c 2p) stats(chi2) 

/*No Difference Awareness of VNA Election in Phase 1 Recruitment*/
tabout electiondateawareness_rc  treatment_group using "Tables\AppendixA22_ElectionAwareness", replace cells(freq col) f(0c 2p)

/*******************************************************************************************************/
/*Appendix C: Balance in Pre-Treatment Confounders*/

/*Panel A: Before Packet Disbursal*/
reg age control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster stat(coef ci) drop(age) replace
reg male control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(male)
reg motorbikes control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(motorbikes)
reg polibg control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(polibg)
reg polistat control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(polistat)
reg politicsinterest_rc control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(politicsinterest_rc)
reg electiondateawareness_rc control T1 T2 T3 , nocons
outreg2 using "Tables\AppendixC_PanelA", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(electiondateawareness_rc) excel


/*Panel B: At Endline Survey*/
reg age control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(age) replace
reg male control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(male)
reg motorbikes control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(motorbikes)
reg polibg control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(polibg)
reg polistat control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(polistat)
reg politicsinterest_rc control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster  stat(coef ci) drop(politicsinterest_rc)
reg electiondateawareness_rc control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\AppendixC_PanelB", bdec(3) tdec(3)  e(rmse N_clust) noaster stat(coef ci) drop(electiondateawareness_rc) excel 
/*******************************************************************************************************/
/*******************************************************************************************************/
/*Appendix D: Response Rate for Endline Survey in Phase 3*/
tabout P3 treatment_group using"Tables\AppendixD", append cells(freq col) f(0c 2p) stats(chi2)
/*******************************************************************************************************/
/*******************************************************************************************************/
/*Appendix E: Attrition is Not Correlated with Treatment*/
generate attrit=1 if P3=="No"
replace attrit=0 if P3=="Yes"

reg attrit T1 T2 T3, robust
outreg2 using "Tables\AppendixE", bdec(3) tdec(3)  e(rmse N_clust) noaster  replace
reg attrit T1 T2 T3 age male motorbikes polibg polistat politicsinterest_rc electiondateawareness_rc, robust
outreg2 using "Tables\AppendixE", bdec(3) tdec(3)  e(rmse N_clust) noaster  excel
/*******************************************************************************************************/
/*******************************************************************************************************/
/*Appendix F1: Differences between Respondents Receiving Follow-Up VNA Questions*/
tabout Questionnaire_order treatment_group using "Tables\AppendixF1", append cells (freq col) f(0c 2p) stats(chi2)
/*******************************************************************************************************/
/*******************************************************************************************************/
/*APPENDIX F2: Civic Education Results are Robust to Limiting Analysis to Only Those with Corrected Survey.*/
areg Vote T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata) 
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", No) keep(T1 T2 T3) stats(coef pval) noaster replace
areg Vote T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata) 
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", No) keep(T1 T2 T3) stats(coef pval) noaster 

areg no_names T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata) 
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Name Candidates (#)") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster
areg no_names T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata) 
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Name Candidates (#)") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster
 
areg no_positions T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Name Positions (#)") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster

areg no_positions T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Name Positions (#)") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster

areg Q11_7 T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster 

areg Q11_7 T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF2", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster excel 

areg VNALegitimacy_all T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF3", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster replace 

areg VNALegitimacy_all T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF3", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster 

areg VNAConfidence_all T1 T2 T3 major1 major2 HCMC if Questionnaire_order==1, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF3", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster 

areg  VNAConfidence_all T1 T2 T3 major1 major2 HCMC if Questionnaire_order==2, cluster(votingdivision2) absorb(strata)
outreg2 using "Tables\AppendixF3", bdec(3) tdec(3) e(rmse N_clust) ctitle("Vote for Positive Change") label addtext("Block FE", Yes, "Major FE", Yes, "City FE", Yes, "Questionnaire_order", Yes) keep(T1 T2 T3) stats(coef pval) noaster excel


/********Multiple Comparisons*****************************/
/*log using "Tables\AppendixF2.smcl", replace*/
preserve 
keep if Questionnaire_order==1
wyoung Vote no_names no_positions Q11_7, cmd(reg OUTCOMEVAR T1 T2 T3 CONTROLVARS, cluster(votingdivision2)) controls("major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6")  familyp(T1 T2 T3) bootstraps(1000) seed(20241016) cluster(votingdivision2)
restore

preserve 
keep if Questionnaire_order==2
wyoung Vote no_names no_positions Q11_7, cmd(reg OUTCOMEVAR T1 T2 T3 CONTROLVARS, cluster(votingdivision2)) controls("major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6")  familyp(T1 T2 T3) bootstraps(1000) seed(20241016) cluster(votingdivision2)
restore
/*log close*/

/*log using "Tables\AppendixF3.smcl", replace*/
preserve 
keep if Questionnaire_order==1
wyoung VNALegitimacy_all VNAConfidence_all, cmd(reg OUTCOMEVAR T1 T2 T3 CONTROLVARS, cluster(votingdivision2)) controls("major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6")  familyp(T1 T2 T3) bootstraps(1000) seed(20241016) cluster(votingdivision2)
restore

preserve 
keep if Questionnaire_order==2
wyoung VNALegitimacy_all VNAConfidence_all, cmd(reg OUTCOMEVAR T1 T2 T3 CONTROLVARS, cluster(votingdivision2)) controls("major1 major2 HCMC strata2 strata3 strata4 strata5 strata6" "major1 major2 HCMC strata2 strata3 strata4 strata5 strata6")  familyp(T1 T2 T3) bootstraps(1000) seed(20241016) cluster(votingdivision2)
restore
/*log close*/
/*********************************************************************************************************************************************************************************************************************************/
/*Appendix G: Qualitative Interviews*/
generate qualitative=2 if treatment_group==0
replace qualitative=8 if treatment_group==1
replace qualitative=2 if treatment_group==2
replace qualitative=5 if treatment_group==3

graph hbar (mean) qualitative, over(treatment_group, label(labcolor("black") labsize(medium))) bar(1, fcolor(blue)) blabel(bar, size(medsmall))  ytitle("Number of Qualitative Interviews")
graph save "Figures\AppendixG.gph", replace
graph export "Figures\AppendixG.pdf", as(pdf) replace

/*********************************************************************************************************************************************************************************************************************************/
/*Appendix H: Reason for Voting in Control Group (n=181)*/
preserve
/*Multiply by 100 to create percentages for graphing*/
foreach x in Q11_1 Q11_2 Q11_3 Q11_4 Q11_5 Q11_6 Q11_7 Q11_8 Q11_9 Q11_10 Q11_11 Q11_12 Q11_13 Q11_14 Q11_15{
	replace `x'=`x'*100
}

graph hbar Q11* if treatment_group==0, legend(pos(9) size(medium) label(1 No Reason) label(2 Name topped list) label(3 Relative/friend instructed) label(4 Voting staff instructed) label(5 Personally know candidate) label(6 Personalistic benefits) label(7 Positive change for community) label(8 Represent citizens' interests) label(9 Professional qualifications) label(10 Candidate's gender) label(11 Candidate's age) label(12 Candidate's race) label(13 Candidate's mass organization) label(14 Local knowledge) label(15 Vote for disadvantaged group)) blabel(bar, size(small) position(Inside) format(%3.1f)) ylab(0(2)28, labsize(small)) ytitle("Main reason for vote choice (%)", size(medium) margin(medsmall))
graph save "Figures\AppendixH.gph", replace
graph export "Figures\AppendixH.pdf", as(pdf) replace
restore
/*********************************************************************************************************************************************************************************************************************************/
/*Appendix I*/
gen yu_aff=0
replace yu=1 if selfingov_yu==1
label val yu_aff polibg2
label var yu_aff "Affiliated with YU?"
tabout politicsinterest_rc yu_aff using "Tables\AppendixI", append cells(freq col) f(0c 2p) stats(chi2)
/*************************************************************************************************************************************




